package com.heer.gymnasium.module.hobby.beans;

import com.heer.gymnasium.base.BaseBean;
import com.heer.gymnasium.module.main.beans.CategoryBean;
import com.heer.gymnasium.module.store.beans.AreaBean;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by yan
 * on 2018/2/9
 */

public class HobbyItemBean extends BaseBean implements Serializable {
    private String id;

    private String name;

    private String iconUrl;

    private boolean selectStatus;

    public HobbyItemBean() {
    }

    public HobbyItemBean(String id, String name) {
        this.id = id;
        this.name = name;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIconUrl() {
        return iconUrl;
    }

    public void setIconUrl(String iconUrl) {
        this.iconUrl = iconUrl;
    }

    public boolean isSelectStatus() {
        return selectStatus;
    }

    public void setSelectStatus(boolean selectStatus) {
        this.selectStatus = selectStatus;
    }

    public interface HobbyType {
        int category = 1;
        int area = 2;
        int time = 3;

    }

    public static List<HobbyItemBean> dataChange(List list, int type) {
        List<HobbyItemBean> hobbyInfoBeanList = new ArrayList<>();
        for (int i = 0; i < list.size(); i++) {
            HobbyItemBean bean = new HobbyItemBean();
            if (type == HobbyType.category) {
                CategoryBean categoryBean = (CategoryBean) list.get(i);
                bean.setId(categoryBean.getId());
                bean.setName(categoryBean.getTitle());
                bean.setIconUrl(categoryBean.getIcon());
            } else if (type == HobbyType.area) {
                AreaBean areaBean = (AreaBean) list.get(i);
                bean.setId(areaBean.getAdcode());
                bean.setName(areaBean.getArea());
            } else {

            }
            hobbyInfoBeanList.add(bean);
        }
        return hobbyInfoBeanList;
    }
}
